import data.names

def Solve():
    result = 0
    count = 0
    for name in sorted(data.names.data):
        count += 1
        score = count * sum(ord(l) - ord('A') + 1 for l in name)
        result += score
    return result
